package com.ding.delegate;

import org.activiti.engine.RuntimeService;
import org.activiti.engine.delegate.BpmnError;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class OnsubprocessDelegate implements JavaDelegate{

	@Autowired
	RuntimeService runtime;
	
	
	@Override
	public void execute(DelegateExecution execution) throws Exception {

		
		runtime.startProcessInstanceByMessage("Message");//通过消息驱动一个流程
		
		throw new BpmnError("error","执行出现错误");//抛出错误
		
	}
	

}
